package classesInterface;

import classesBancodeDados.FichaNotificacaoInfeccao;
import classesBancodeDados.Paciente;
import classesJpa.FichaNotificacaoInfeccaoJpaController;
import classesJpa.exceptions.NonexistentEntityException;
import classesMiolo.DataHorario;
import classesMiolo.MapasPaciente;
import classesMiolo.ReverseMapper;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFrame;

public class TelaFichaNotifInfec extends javax.swing.JFrame {

    /**
     * Creates new form Ficha_Notif_Infec
     */
    private TelaFichaNotifInfec() {
        initComponents();
        setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    }
    
    public static TelaFichaNotifInfec getInstance(){
        if(instance == null) instance = new TelaFichaNotifInfec();
        return instance;
    }

    public void limpaCampos(){
        TelaFichaNotifInfec fni = TelaFichaNotifInfec.getInstance();
        fni.areaAntibProf.setText("");
        fni.areaNoAntib.setText("");
        fni.areaAntibTer.setText("");
        fni.campoEspecificar.setText("");
        fni.setor.setText("");
        fni.nome.setText("");
        fni.idade.setText("");
        fni.nLeito.setText("");
        fni.feridaOperatoria.setSelected(false);
        fni.infeccaoComunitaria.setSelected(false);
        fni.infeccaoCruzada.setSelected(false);
        fni.infeccaoHospitalar.setSelected(false);
        fni.respiratoria.setSelected(false);
        fni.gastroIntestinal.setSelected(false);
        fni.cutanea.setSelected(false);
        fni.genital.setSelected(false);
        fni.outras.setSelected(false);
        fni.ocular.setSelected(false);
        fni.sepsis.setSelected(false);
        fni.urinaria.setSelected(false);
    }
    
    public void turnEditable(boolean editable){
        TelaFichaNotifInfec fni = TelaFichaNotifInfec.getInstance();
        botaoSalvar.setEnabled(editable);
        //Ficha
        fni.cutanea.setEnabled(editable);
        fni.feridaOperatoria.setEnabled(editable);
        fni.gastroIntestinal.setEnabled(editable);
        fni.genital.setEnabled(editable);
        fni.infeccaoComunitaria.setEnabled(editable);
        fni.infeccaoCruzada.setEnabled(editable);
        fni.infeccaoHospitalar.setEnabled(editable);
        fni.ocular.setEnabled(editable);
        fni.outras.setEnabled(editable);
        fni.respiratoria.setEnabled(editable);
        fni.sepsis.setEnabled(editable);
        fni.setor.setEditable(editable);
        fni.urinaria.setEnabled(editable);
        fni.campoEspecificar.setEditable(editable);
        fni.areaAntibProf.setEditable(editable);
        fni.areaAntibTer.setEditable(editable);
        fni.areaNoAntib.setEditable(editable);
        
        //Paciente
        fni.idade.setEditable(false);
        fni.nLeito.setEditable(false);
        fni.nome.setEditable(false);        
        fni.sexo.setEditable(false);
    }
    
    public void preencherCampos(Paciente p, FichaNotificacaoInfeccao ni){
        this.cutanea.setSelected(ni.getInfection().isCutanea());
        this.feridaOperatoria.setSelected(ni.getInfection().isFeridaOperatoria());
        this.gastroIntestinal.setSelected(ni.getInfection().isGastrointestinal());
        this.genital.setSelected(ni.getInfection().isGenital());
        this.idade.setText("" + DataHorario.calculaIdade(p.getDataDeNascimento()));
        char aux = ni.getInfection().getTipo();
        if(aux == 'a') this.infeccaoHospitalar.setSelected(true);
        if(aux == 'b') this.infeccaoCruzada.setSelected(true);
        if(aux == 'c') this.infeccaoComunitaria.setSelected(true);
        this.areaAntibProf.setText(ni.getAntibProfilatico());
        this.areaAntibTer.setText(ni.getAntibTerap());
        this.areaNoAntib.setText(ni.getMotivoNoAntib());
        this.nLeito.setText("" + ni.getLeito());
        this.nome.setText(p.getNome());
        this.ocular.setSelected(ni.getInfection().isOcular());
        if(ni.getInfection().getOutros().equals("")){
            this.outras.setSelected(false);
            this.campoEspecificar.setText("");
        }else{
            this.outras.setSelected(true);
            this.campoEspecificar.setText(ni.getInfection().getOutros());
        }
        this.respiratoria.setSelected(ni.getInfection().isRespiratoria());
        this.sepsis.setSelected(ni.getInfection().isSepsis());
        this.setor.setText(ni.getSetor());
        MapasPaciente mp = MapasPaciente.getInstance();
        this.sexo.setSelectedItem(ReverseMapper.getKeyFromValue(mp.getSexo(), p.getSexo()));
        this.urinaria.setSelected(ni.getInfection().isUrinaria());
    }
    
    private void salvar(){
        ficha.getInfection().setCutanea(this.cutanea.isSelected());
        ficha.getInfection().setFeridaOperatoria(this.feridaOperatoria.isSelected());
        ficha.getInfection().setGastrointestinal(this.gastroIntestinal.isSelected());
        ficha.getInfection().setGenital(this.genital.isSelected());
        if(this.infeccaoComunitaria.isSelected()){
            ficha.getInfection().setTipo('c');
        }else if(this.infeccaoCruzada.isSelected()){
            ficha.getInfection().setTipo('b');
        }else if(this.infeccaoHospitalar.isSelected()){
            ficha.getInfection().setTipo('a');
        }
        ficha.getInfection().setOcular(this.ocular.isSelected());
        if(this.outras.isSelected()){
            ficha.getInfection().setOutros(this.campoEspecificar.getText());
        }
        ficha.getInfection().setRespiratoria(this.respiratoria.isSelected());
        ficha.getInfection().setSepsis(this.sepsis.isSelected());
        ficha.setSetor(this.setor.getText());
        ficha.getInfection().setUrinaria(this.urinaria.isSelected());
        ficha.setAntibProfilatico(this.areaAntibProf.getText());
        ficha.setAntibTerap(this.areaAntibTer.getText());
        ficha.setMotivoNoAntib(this.areaNoAntib.getText());
        
        FichaNotificacaoInfeccaoJpaController nic = new FichaNotificacaoInfeccaoJpaController();
        try {
            nic.edit(ficha);
        } catch (NonexistentEntityException ex) {
            Logger.getLogger(TelaFichaNotifInfec.class.getName()).log(Level.SEVERE, null, ex);
        } catch (Exception ex) {
            Logger.getLogger(TelaFichaNotifInfec.class.getName()).log(Level.SEVERE, null, ex);
        }
    }


    
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        setor = new javax.swing.JTextField();
        nome = new javax.swing.JTextField();
        idade = new javax.swing.JTextField();
        nLeito = new javax.swing.JTextField();
        infeccaoHospitalar = new javax.swing.JRadioButton();
        infeccaoCruzada = new javax.swing.JRadioButton();
        infeccaoComunitaria = new javax.swing.JRadioButton();
        feridaOperatoria = new javax.swing.JCheckBox();
        urinaria = new javax.swing.JCheckBox();
        respiratoria = new javax.swing.JCheckBox();
        sepsis = new javax.swing.JCheckBox();
        gastroIntestinal = new javax.swing.JCheckBox();
        ocular = new javax.swing.JCheckBox();
        cutanea = new javax.swing.JCheckBox();
        genital = new javax.swing.JCheckBox();
        outras = new javax.swing.JCheckBox();
        campoEspecificar = new javax.swing.JTextField();
        jScrollPane2 = new javax.swing.JScrollPane();
        areaAntibProf = new javax.swing.JTextArea();
        jScrollPane3 = new javax.swing.JScrollPane();
        areaNoAntib = new javax.swing.JTextArea();
        jScrollPane4 = new javax.swing.JScrollPane();
        areaAntibTer = new javax.swing.JTextArea();
        sexo = new javax.swing.JComboBox();
        botaoSalvar = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
        });

        jLabel1.setText("Ficha de Notificação de Infecção");

        jLabel2.setText("Setor:");

        jLabel3.setText("1. Dados do Usuário do Serviço CPJM");

        jLabel4.setText("Nome Completo:");

        jLabel5.setText("Sexo:");

        jLabel6.setText("Idade:");

        jLabel7.setText("Nº Leito: ");

        jLabel8.setText("2. Tipo de Infecção:");

        jLabel9.setText("3. Topografia da Infecção");

        jLabel10.setText("Especificar:");

        jLabel11.setText("4. Uso de Antibióticos:");

        jLabel12.setText("Antibiótico profilático: ");

        jLabel13.setText("Antibiótico terapêutico: ");

        jLabel14.setText("Não fez uso de antibiótico. Motivo: ");

        nome.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                nomeActionPerformed(evt);
            }
        });

        infeccaoHospitalar.setText("Infecção hospitalar");

        infeccaoCruzada.setText("Infecção cruzada");
        infeccaoCruzada.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                infeccaoCruzadaActionPerformed(evt);
            }
        });

        infeccaoComunitaria.setText("Infecção comunitária");

        feridaOperatoria.setText("Ferida Operatória");

        urinaria.setText("Urinária");
        urinaria.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                urinariaActionPerformed(evt);
            }
        });

        respiratoria.setText("Respiratória");

        sepsis.setText("Sepsis");

        gastroIntestinal.setText("Gastro Intestinal");

        ocular.setText("Ocular");

        cutanea.setText("Cutânea");
        cutanea.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cutaneaActionPerformed(evt);
            }
        });

        genital.setText("Genital");

        outras.setText("Outras");

        areaAntibProf.setColumns(20);
        areaAntibProf.setRows(5);
        jScrollPane2.setViewportView(areaAntibProf);

        areaNoAntib.setColumns(20);
        areaNoAntib.setRows(5);
        jScrollPane3.setViewportView(areaNoAntib);

        areaAntibTer.setColumns(20);
        areaAntibTer.setRows(5);
        jScrollPane4.setViewportView(areaAntibTer);

        sexo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Masculino", "Feminino" }));

        botaoSalvar.setText("Salvar");
        botaoSalvar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botaoSalvarActionPerformed(evt);
            }
        });

        jButton2.setText("Cancelar");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel4)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(nome))
                    .addComponent(jScrollPane4)
                    .addComponent(jScrollPane3)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel10)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(campoEspecificar))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel3)
                            .addComponent(jLabel8)
                            .addComponent(jLabel9)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                    .addComponent(jLabel2)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(setor))
                                .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.LEADING))
                            .addComponent(jLabel14)
                            .addComponent(jLabel12)
                            .addComponent(jLabel11)
                            .addComponent(jLabel13)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel5)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(sexo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(66, 66, 66)
                                .addComponent(jLabel6)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(idade, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel7)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(nLeito, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addGroup(layout.createSequentialGroup()
                                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(urinaria)
                                                .addComponent(respiratoria))
                                            .addGap(96, 96, 96))
                                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                            .addComponent(infeccaoHospitalar)
                                            .addGap(33, 33, 33)))
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(feridaOperatoria)
                                        .addGap(56, 56, 56)))
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(sepsis)
                                    .addGroup(layout.createSequentialGroup()
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(infeccaoCruzada)
                                            .addComponent(cutanea)
                                            .addComponent(gastroIntestinal))
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(layout.createSequentialGroup()
                                                .addGap(19, 19, 19)
                                                .addComponent(infeccaoComunitaria))
                                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                    .addComponent(genital)
                                                    .addComponent(outras)
                                                    .addComponent(ocular))
                                                .addGap(12, 12, 12)))))))
                        .addGap(0, 120, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(jButton2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(botaoSalvar)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(setor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(nome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(jLabel6)
                    .addComponent(jLabel7)
                    .addComponent(idade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(nLeito, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(sexo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel8)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(infeccaoHospitalar)
                    .addComponent(infeccaoCruzada)
                    .addComponent(infeccaoComunitaria))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel9)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(feridaOperatoria)
                    .addComponent(ocular)
                    .addComponent(sepsis))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(urinaria)
                    .addComponent(genital)
                    .addComponent(gastroIntestinal))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(outras)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(respiratoria)
                        .addComponent(cutanea)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10)
                    .addComponent(campoEspecificar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(17, 17, 17)
                .addComponent(jLabel11)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel12)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel13)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jLabel14)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(botaoSalvar)
                    .addComponent(jButton2))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void infeccaoCruzadaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_infeccaoCruzadaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_infeccaoCruzadaActionPerformed

    private void nomeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nomeActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_nomeActionPerformed

    private void urinariaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_urinariaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_urinariaActionPerformed

    private void cutaneaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cutaneaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_cutaneaActionPerformed

    private void botaoSalvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botaoSalvarActionPerformed
        salvar();
        this.setVisible(false);
    }//GEN-LAST:event_botaoSalvarActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        limpaCampos();
        setVisible(false);
    }//GEN-LAST:event_jButton2ActionPerformed

    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
        limpaCampos();
    }//GEN-LAST:event_formWindowClosing

    public FichaNotificacaoInfeccao getFicha() {
        return ficha;
    }

    public void setFicha(FichaNotificacaoInfeccao ficha) {
        this.ficha = ficha;
    }  
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(TelaFichaNotifInfec.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(TelaFichaNotifInfec.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(TelaFichaNotifInfec.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(TelaFichaNotifInfec.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                TelaFichaNotifInfec.getInstance().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextArea areaAntibProf;
    private javax.swing.JTextArea areaAntibTer;
    private javax.swing.JTextArea areaNoAntib;
    private javax.swing.JButton botaoSalvar;
    private javax.swing.JTextField campoEspecificar;
    private javax.swing.JCheckBox cutanea;
    private javax.swing.JCheckBox feridaOperatoria;
    private javax.swing.JCheckBox gastroIntestinal;
    private javax.swing.JCheckBox genital;
    private javax.swing.JTextField idade;
    private javax.swing.JRadioButton infeccaoComunitaria;
    private javax.swing.JRadioButton infeccaoCruzada;
    private javax.swing.JRadioButton infeccaoHospitalar;
    private javax.swing.JButton jButton2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JTextField nLeito;
    private javax.swing.JTextField nome;
    private javax.swing.JCheckBox ocular;
    private javax.swing.JCheckBox outras;
    private javax.swing.JCheckBox respiratoria;
    private javax.swing.JCheckBox sepsis;
    private javax.swing.JTextField setor;
    private javax.swing.JComboBox sexo;
    private javax.swing.JCheckBox urinaria;
    // End of variables declaration//GEN-END:variables
    private static TelaFichaNotifInfec instance = null;
    private FichaNotificacaoInfeccao ficha;
}
